package other.mvvm.activity.src.app_package.login

fun loginAcitivityKt(
        applicationPackage:String?,
        activityClass:String,
        packageName:String
)="""
package $packageName
import android.os.Bundle
import cn.logicalthinking.mvvm.base.BaseActivity
import androidx.lifecycle.Observer
import ${applicationPackage}.R
import ${packageName}.${activityClass}ViewModel
import ${applicationPackage}.databinding.Activity${activityClass}Binding
/**
* 登录界面
**/
class ${activityClass}Activity : BaseActivity<Activity${activityClass}Binding, ${activityClass}ViewModel>() {
 

    override fun Activity${activityClass}Binding.initView() {
          /**
         * 登录
         */
        tvLogin.clickDelay {
            KeyboardUtils.hideSoftInput(this@LoginActivity)
            if(edAccount.text.toString().isEmpty()) {
                ToastUtils.showShort("请输入邮箱")
                return@clickDelay
            }

            if(!RegexUtils.isEmail(edAccount.text.toString())) {
                ToastUtils.showShort("输入邮箱格式有误")
                return@clickDelay
            }

            if(edPassword.text.toString().isEmpty()) {
               ToastUtils.showShort("输入密码为空")
                return@clickDelay
            }
            mViewModel.login(edAccount.text.toString(),edPassword.text.toString()){
                
            }
        }
    }

    override fun initLiveDataObserve() {  
        
        
    }

    override fun initData() {
        
    }
    
   
} 
"""